import https from '../libs/mehaotian-request/interface.js'
import config from '../config/index.js'

/**
 * 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * handle [boolean] 如果需要自己处理 catch 请求 ，传入 true ，交给接口统一处理 ，请传如 false或不传
 */

// 单独导出
export const wxSappLogin = (data) => {
	return https ({
		url: '/wl/sapp/login',
		header: {
			'wx-code': data.code,
			'wx-encrypted-data': data.data,
			'wx-iv': data.iv
		}
		// handle:true
	})
}

export const getUserInfo = () => {
	return https ({
		url: '/wl/sapp/getUserInfo',
		// handle:true
	})
}

export const decodeMobile = (data) => {
	return https ({
		url: '/wl/sapp/decodeMobile',
		data:data
		// handle:true
	})
}

export const createQrcode = (data) => {
	return https ({
		url: '/wl/sapp/createQrcode',
		data:data
		// handle:true
	})
}

export const saveUserInfo = (data) => {
	return https ({
		url: '/wl/sapp/saveUserInfo',
		data:data,
		method: 'post'
		// handle:true
	})
}

export const addUserLog = (data) => {
	return https ({
		url: '/wl/sapp/addUserLog',
		data:data,
		// handle:true
	})
}

export const verify = (data) => {
	return https ({
		url: '/api/uc/smc/smsService/getCodePic',
		method: 'get'
	})
}

export const sendMsg = (mobile, code, key) => {
	return https ({
		url: '/api/uc/smc/smsService/createVerificationCode',
		data: {
			mobile: mobile,
			vcode: code,
			key
		},
		method: 'get'
	})
}

export const sappBingMobile = (mobile, code, ticket, data, iv) => {
	return https ({
		url: '/Api/Api/sappBingMobile',
		header: {
			'wx-encrypted-data': data,
			'wx-iv': iv
		},
		data: {
			mobile: mobile,
			code: code,
			ticket: ticket
		},
		method: 'get'
	})
}

export const mLogin = () => {
	return https ({
		url: '/wl/mLogin',
		data:{
			openid: 'ohOcC0iR8_VB7QOi8FTMQNhbFgA4',
			unionid: 'opIXV5x8YNwEv_9WT4eEkan6qmFM',
			id: '59805834eedf4ba1af34c508e982773c'
		},
		method: 'get'
	})
}


